#include "radiobutton.h"
#include "ui_radiobutton.h"

radioButton::radioButton(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::radioButton)
{
    ui->setupUi(this);

    // 设置一个默认的选项
    ui->radioButton_man->setChecked(true);
    ui->label->setText("您的性别为:男");

    // 禁用自行车选项
    // ui->radioButton_bike->setCheckable(false); // 点击事件依然可以响应
    ui->radioButton_bike->setEnabled(false);
}

radioButton::~radioButton()
{
    delete ui;
}

void radioButton::on_radioButton_man_clicked()
{
    ui->label->setText("您的性别为:男");
}

void radioButton::on_radioButton_feman_clicked()
{
    ui->label->setText("您的性别为:女");
}

void radioButton::on_radioButton_bike_clicked()
{
    ui->label->setText("您的性别为:自行车");
}
